//
//  BaseViewController.swift
//  SkyWeather
//
//  Created by lx on 2020/11/4.
//

import UIKit

class BaseViewController: UIViewController {
        
    override func viewDidLoad() {
        super.viewDidLoad()

        self.view.backgroundColor = .bg;

        self.navigationItem.leftBarButtonItem = UIBarButtonItem.init(image: UIImage.init(named: "return.png")?.withRenderingMode(.alwaysOriginal), style: .plain, target: self, action: #selector(back))
    }
    
    @objc func back() {
        if let navigationController = navigationController {
            if (navigationController.popViewController(animated: true)) == nil {
                navigationController.dismiss(animated: true, completion: {
                    
                })
            }
        }else {
            dismiss(animated: true) {
                
            }
        }
    }

}
